home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIP Haziran 2001.iso / prog / share / 04 / setup.exe / MM9.Cab / F1483_troubleshooting.asp.9B3B646D_CB56_4EAE_BAB7_3E7E8E41A649 < prev    next >
Text File  |  2000-08-17  |  50KB  |  1,173 lines

  1. <script runat="server" language="VBScript">
  2.  
  3. Response.ContentType = "text/html"
  4. on error resume next
  5.  
  6. ' --- troubleshooting.asp -----------------------------------------------------
  7. ' Copyright 1999-2000 Adobe Systems Incorporated. All rights reserved.
  8. '
  9. ' Dynamic Link Troubleshooting Report
  10. '
  11. ' This Active Server Page file performs a series of tests to verify that
  12. ' the Adobe GoLive server files are properly installed and configured.
  13. '
  14. ' IMPORTANT: This file is for troubleshooting purposes only.  You should not
  15. ' leave this file installed on a production server because it might provide
  16. ' users with information about your security setup and the structure of your
  17. ' database files.
  18. ' -----------------------------------------------------------------------------
  19.  
  20.  
  21.  
  22. ' -----------------------------------------------------------------------------
  23. ' Call the main function, written in JScript, below.
  24.  
  25. main()
  26.  
  27.  
  28. ' -----------------------------------------------------------------------------
  29. ' These VBScript functions are utility functions for the tests, below.
  30.  
  31. function getVBScriptEngineVersion
  32.     dim msg
  33.     msg = ""
  34.     msg = msg & ScriptEngineMajorVersion & "."
  35.     msg = msg & ScriptEngineMinorVersion & "."
  36.     msg = msg & ScriptEngineBuildVersion 
  37.     getVBScriptEngineVersion = msg
  38. end function
  39.  
  40.  
  41. function getVBScriptEngineMajorVersion
  42.     getVBScriptEngineMajorVersion = ScriptEngineMajorVersion
  43. end function
  44.  
  45.  
  46. function writeServerVariables()
  47.     msg = ""
  48.     for each name in Request.ServerVariables
  49.         msg = msg + "<tr><td>" & vbNewLine
  50.         msg = msg +     name & "" & vbNewLine
  51.         msg = msg +     "</td><td>" & vbNewLine
  52.         msg = msg +     Request.ServerVariables( name ) & "<br>" & vbNewLine
  53.         msg = msg +     "</td></tr>" & vbNewLine
  54.     next
  55.     writeServerVariables = msg
  56. end function
  57.  
  58.  
  59. function testWriteFileOnServer( fso, filePath )
  60.     on error resume next
  61.  
  62.     set testFile = fso.CreateTextFile( filePath )
  63.     testFile.writeline( "GoLive Dynamic Link" )
  64.     testFile.close()
  65.     fso.deleteFile( filePath )
  66.  
  67.     if Err then
  68.         testWriteFileOnServer = false
  69.     else
  70.         testWriteFileOnServer = true
  71.     end if
  72. end function
  73.  
  74.  
  75. function testConnectionOpen( connection, connectString )
  76.     on error resume next
  77.  
  78.     connection.Open( connectString )
  79.  
  80.     if Err then
  81.         testConnectionOpen = false
  82.     else
  83.         testConnectionOpen = true
  84.     end if
  85. end function
  86.  
  87.  
  88. function testOpenSchema( connection )
  89.     on error resume next
  90.  
  91.     set schema = connection.OpenSchema( 20 ) ' 20: adSchemaTables = 20
  92.     msg = ""
  93.  
  94.     if Err then
  95.     else
  96.         msg = msg + "Success</td><td>"
  97.         do until schema.EOF
  98.             if( schema( "TABLE_TYPE" ) = "TABLE" ) then
  99.                 msg = msg + "<dl>" & vbNewLine
  100.                 msg = msg + "<dt>" & schema( "TABLE_NAME" ) & vbNewLine
  101.                 msg = msg + listDatabaseField( connection, schema( "TABLE_NAME" ))
  102.                 msg = msg + "</dl>" & vbNewLine
  103.             end if
  104.             schema.MoveNext
  105.         Loop
  106.     end if
  107.     testOpenSchema = msg
  108. end function
  109.  
  110.  
  111. function testIndexColumns( index )
  112.     on error resume next
  113.  
  114.     count = index.Columns.Count
  115.  
  116.     if Err then
  117.         testIndexColumns = false
  118.     else
  119.         testIndexColumns = true
  120.     end if
  121. end function
  122.  
  123. </script>
  124.  
  125. <script runat="server" language="JScript">
  126.  
  127. var    noPrimaryKey = 0;
  128.  
  129. // Top level function that invokes and displays the tests.
  130. function main()
  131. {
  132.     Response.Write( htmlHeader() );
  133.  
  134.     Response.Write( "<h1>Adobe GoLive Dynamic Link Troubleshooting Report</h1>\n" );
  135.     Response.Write( "<p>Copyright 1999-2000 Adobe Systems Incorporated.  All rights reserved.</p>\n" );
  136.     Response.Write( "<p>This report contains information about the status of your ASP server software and the Adobe GoLive Dynamic Link files installed on the server.\n" );
  137.     Response.Write( "Below you will find the results of various tests performed by this troubleshooting script.</p>\n" );
  138.     Response.Write( "<p>Please refer to chapter 16 of the GoLive User Guide for more information about installing and configuring your ASP server to work with Adobe GoLive.</p>\n" );
  139.  
  140.     var    TestResults = new Array();
  141.  
  142.     // perform each test and store resulting Test objects in TestResults
  143.     TestResults[0]    = checkASPSoftware();
  144.     TestResults[1]    = checkServerVersion();
  145.     TestResults[2]    = checkScriptEngineVersion();
  146.     TestResults[3]    = checkVirtualPathSetting();
  147.     TestResults[4]    = checkPasswordSetting();
  148.     TestResults[5]    = checkServerConfigFiles();
  149.     TestResults[6]    = checkServerConfigFilesReturnCode();
  150.     TestResults[7]    = checkServerConfigFriendsFile();
  151.     TestResults[8]    = checkServerConfigWritePrivilege();
  152.     TestResults[9]    = checkServerXMLFileFormat();
  153.     TestResults[10] = checkServerDefaultDatabaseFiles();
  154.     TestResults[11] = checkServerDatabaseFiles();
  155.     TestResults[12] = checkServerVariable();
  156.     TestResults[13] = checkOther();
  157.  
  158.     // write out the test summary, followed by the individual test details
  159.     Response.Write( reportSummary( TestResults ));
  160.     Response.Write( reportDetail( TestResults ));
  161.  
  162.     Response.Write( htmlFooter() );
  163.     return 0;
  164. }
  165.  
  166. function htmlHeader()
  167. {
  168.     var result = "<html>\n";
  169.     result += "<head>\n";
  170.     result += "<title>Dynamic Link Troubleshooting Report</title>\n";
  171.     result += "<style type=\"text/css\">\n";
  172.     result += "<\!--\n";
  173.     result += ".passed { Color: #00F; font-weight: bold }\n";
  174.     result += ".failed { Color: #F00; font-weight: bold }\n";
  175.     result += ".verify { Color: #080; font-weight: bold }\n";
  176.     result += ".manual { border: black thin solid; width: 100%; height: auto; margin: 10px; padding: 10px }\n";
  177.     result += ".manualTitle { Color: orange }\n";
  178.     result += ".manualSymptom { Color: #000 }\n";
  179.     result += ".manualPrescription { Color: #000 }\n";
  180.     result += "-->\n";
  181.     result += "</style>\n";
  182.     result += "</head>\n";
  183.     result += "<body>\n";
  184.     result += "<a name=\"_top\"></a>\n";
  185.     return result;
  186. }
  187.  
  188. function htmlFooter()
  189. {
  190.     var result = "<hr>\n";
  191.     result += "</body>\n";
  192.     result += "</html>\n";
  193.     return result;
  194. }
  195.  
  196. function reportSummary( TestResults )
  197. {
  198.     var report = "<hr>\n";
  199.  
  200.     report += "<h2>Test Summary</h2>\n";
  201.     report += "<b>" + TestResults.length + " tests performed.</b><p>";
  202.     report += "<p><table border=\"1\" cellpadding=\"4\">\n";
  203.     report += "<tr><th>Test</th><th>Description</th><th>Results</th></tr>\n";
  204.     for( var i = 0; i < TestResults.length; i++ ){
  205.         var test = TestResults[i];
  206.         report += "<tr><td align=\"center\">" + ( i + 1 ) + "</td><td><a href=\"#" + ( i + 1 ) + "\">" + test.title + "</a></td><td>";
  207.         report += test.ResultStr() + "</td></tr>\n";
  208.     }
  209.     report += "</table></p>\n";
  210.     report += "<h3>How to read the test results</h3>\n";
  211.     report += Test.ResultStr[0] + ": The test was successful, no further action required.</p>\n";
  212.     report += Test.ResultStr[1] + ": Problem(s) were found. Refer to the test report details for more information.</p>\n";
  213.     report += Test.ResultStr[2] + ": This may or may not be a problem depending on your environment, your should manually verify this information.  Read the report details for instructions.</p>\n";
  214.  
  215.     return report;
  216. }
  217.  
  218.  
  219. function reportDetail( TestResults )
  220. {
  221.     var report = "";
  222.     
  223.     for( var i = 0; i < TestResults.length; i++ ){
  224.         var test = TestResults[i];
  225.         
  226.         report += "<hr>\n";
  227.         report += "<a name=\"" + ( i + 1 ) + "\"></a>\n";
  228.         report += "<h2> Test " + ( i + 1 ) + ": " + test.title + "</h2>\n";
  229.         report += "<p>" + test.ResultStr() + ": " + test.summary + "</p>\n";
  230.         report += "<p><b>Description: </b>" + test.description + "</p>\n";
  231.         report += test.details;
  232.         report += "<p><a href=\"#top\">Back to Top</a></p>\n";
  233.     }
  234.     return report;
  235. }
  236.  
  237.  
  238. // --- Test Class -------------------------------------------------------------
  239. // A simple object with instance variables containing the results.
  240. // ----------------------------------------------------------------------------
  241.  
  242. function Test( title )
  243. {
  244.     this.title            = title;
  245.     this.description    = "";
  246.     this.details        = "";
  247.     this.result            = Test.kPass;
  248.     this.summary        = "";
  249. }
  250.  
  251. // Test results are one of the following
  252. Test.kPass     = 0;
  253. Test.kFail     = 1;
  254. Test.kVerify = 2;
  255.  
  256. // HTML strings for each test result
  257. Test.ResultStr = new Array(
  258.     "<span class=\"passed\">Passed</span>",
  259.     "<span class=\"failed\">Failed</span>",
  260.     "<span class=\"verify\">Verify</span>" );
  261.  
  262. function test_Pass( summary )
  263. {
  264.     this.result     = Test.kPass;
  265.     this.summary = summary;
  266. }
  267. Test.prototype.Pass = test_Pass;
  268.  
  269. function test_Fail( summary )
  270. {
  271.     this.result     = Test.kFail;
  272.     this.summary = summary;
  273. }
  274. Test.prototype.Fail = test_Fail;
  275.  
  276. function test_Verify( summary )
  277. {
  278.     this.result     = Test.kVerify;
  279.     this.summary = summary;
  280. }
  281. Test.prototype.Verify = test_Verify;
  282.  
  283. function test_ResultStr()
  284. {
  285.     return Test.ResultStr[this.result];
  286. }
  287. Test.prototype.ResultStr = test_ResultStr;
  288.  
  289.  
  290. // --- Test Creation Functions ------------------------------------------------
  291. // These functions create a new Test object, perform a test, and return the
  292. // Test object with the results.
  293. // ----------------------------------------------------------------------------
  294.  
  295. function checkASPSoftware()
  296. {
  297.     var test = new Test( "Check ASP software" );
  298.     test.description  = "This test checks to see whether your web server is enabled for Active Server Pages. "
  299.     test.description += "Note that IIS 2.0 requires an additional ASP pack. IIS 3 or later includes ASP support by default. "
  300.     test.description += "The IIS configuration (Site Management Console or other application) should have \"Script Enabled\" for the web site folder. "
  301.  
  302.     test.Pass( "ASP software is present." );
  303.  
  304.     return test;
  305. }
  306.  
  307.  
  308. function checkServerVersion()
  309. {
  310.     var test = new Test( "Check Web server version" );
  311.     test.description = "This test checks to make sure your Microsoft IIS software version is 4.0 or later."
  312.     test.details  = "<table border=\"1\" cellpadding=\"4\">\n";
  313.     test.details += "<tr><th>Server variable</th><th>Value</th></tr>\n";
  314.     test.details += "<tr><td>SERVER_SOFTWARE</td><td>" + Request.ServerVariables( "SERVER_SOFTWARE" ) + "</td></tr>\n";
  315.     test.details += "</table>\n";
  316.     test.details += "<p>\n";
  317.  
  318.     var versions = new Array( "Microsoft-IIS/4.0", "Microsoft-IIS/5.0" );    // PWS' string is same as IIS4
  319.     var found = -1;
  320.     for( var i = 0; i < versions.length; i++ ){
  321.         if( String( Request.ServerVariables( "SERVER_SOFTWARE" )) == versions[i] ){
  322.             found = i;
  323.             break;
  324.         }
  325.     }
  326.     if( 0 <= found )    test.Pass( "ASP enabled web server \"" + versions[i] + "\" was found." );
  327.     else                test.Fail( "Server version should be 4.0 or later." );
  328.     return test;
  329. }
  330.  
  331.  
  332. function checkScriptEngineVersion()
  333. {
  334.     var test = new Test( "Check script engine version" );
  335.     test.description  = "This test checks to make sure your server script engine versions are 3.0 or later. "
  336.     test.description += "The script versions are depend on installed IIS or IE on the server. "
  337.     test.description += "If you install IIS 4.0, then you have version 3.0 script engine. "
  338.     test.description += "After that, if you install IE 5.0, then you will have version 5.0 script engine. "
  339.     test.description += "Note: If you have version 3.0 script engine, it requires to install NT service pack 5 or later to fix some problems. "
  340.     test.details  = "<table border=\"1\" cellpadding=\"4\">\n";
  341.     test.details += "<tr><th>Script language</th><th>Version</th></tr>\n";
  342.     test.details += "<tr><td>JScript</td><td>" + ScriptEngineMajorVersion() + "." + ScriptEngineMinorVersion() + "." + ScriptEngineBuildVersion() + "</td></tr>\n";
  343.     test.details += "<tr><td>VBScript</td><td>" + getVBScriptEngineVersion() + "</td></tr>\n";
  344.     test.details += "</table>\n";
  345.     test.details += "<p>\n";
  346.  
  347.     var JSVersion = ScriptEngineMajorVersion();
  348.     var VBVersion = getVBScriptEngineMajorVersion();
  349.     
  350.     if(( 3 <= JSVersion )&&( 3 <= VBVersion )){
  351.         if(( ScriptEngineMajorVersion() == 3 )&&( ScriptEngineMinorVersion() == 1 )&&( ScriptEngineBuildVersion() == 2124 )){
  352.             test.Fail( "Script version 3.1.2124 is not supported. Please update script engine with Windows NT service pack 5 or later. For Windows 98, please install newer version of Internet Explore." );
  353.         }else{
  354.             test.Pass( "Both server script versions are 3.0 or later." );
  355.         }
  356.     }else{
  357.         test.Fail( "Both server script version should be 3.0 or later." );
  358.     }
  359.  
  360.     return test;
  361. }
  362.  
  363.  
  364. function checkVirtualPathSetting()
  365. {
  366.     var test = new Test( "Check virtual path setting" );
  367.  
  368.     test.description  = "This test checks that the virtual path to your web site folder for your URL points to the correct place. "
  369.     test.description += "APPL_PHYSICAL_PATH is your virtual root setting. "
  370.     test.description += "PATH_TRANSLATED is the physical path setting for this page. "
  371.     test.description += "PATH_INFO, SCRIPT_NAME & URL contains the URL to this page without the hostname. "
  372.  
  373.     test.details  = "<table border=\"1\" cellpadding=\"4\">\n";
  374.     test.details += "<tr><th>Server variable</th><th>Value</th></tr>\n";
  375.     test.details += "<tr><td>APPL_PHYSICAL_PATH </td><td>" + Request.ServerVariables("APPL_PHYSICAL_PATH") + "</td></tr>\n";
  376.     test.details += "<tr><td>PATH_INFO          </td><td>" + Request.ServerVariables("PATH_INFO"         ) + "</td></tr>\n";
  377.     test.details += "<tr><td>PATH_TRANSLATED    </td><td>" + Request.ServerVariables("PATH_TRANSLATED"     ) + "</td></tr>\n";
  378.     test.details += "<tr><td>SCRIPT_NAME        </td><td>" + Request.ServerVariables("SCRIPT_NAME"         ) + "</td></tr>\n";
  379.     test.details += "<tr><td>URL                </td><td>" + Request.ServerVariables("URL"                 ) + "</td></tr>\n";
  380.     test.details += "</table>\n";
  381.  
  382.     test.Verify( "You should verify that your virtual path settings are correct." );
  383.  
  384.     return test;
  385. }
  386.  
  387.  
  388. function checkPasswordSetting()
  389. {
  390.     var test = new Test( "Check password setting of web server" );
  391.  
  392.     test.description  = "This test checks whether the web server is set to require user names and passwords. If so, only basic authentication is supported by Dynamic Link. "
  393.     test.description += "If any of the following server variables have a value, there is a password required to access the server. "
  394.     test.description += "In case of basic authentication, server variable HTTP_AUTHORIZATION's value will start \"Basic \". "
  395.     test.description += "Other http authentication methods are not supported. "
  396.  
  397.     var auth_user    = Request.ServerVariables( "AUTH_USER" );
  398.     var remote_user = Request.ServerVariables( "REMOTE_USER" );
  399.     var logon_user    = Request.ServerVariables( "LOGON_USER" );
  400.     var http_authorization = Request.ServerVariables( "HTTP_AUTHORIZATION" );
  401.     var error = 0;
  402.  
  403.     if((( auth_user != "" )&&( auth_user == "undefined" ))||( remote_user != "" )||( logon_user != "" )){ //    ( auth_user == "undefined" ) is IIS3 support
  404.         if( String( http_authorization ).indexOf( "Basic" ) == 0 )    error = 1;
  405.         else                                                        error = 2;
  406.     }
  407.  
  408.     test.details  = "<table border=\"1\" cellpadding=\"4\">\n";
  409.     test.details += "<tr><th>Server variable</th><th>Value</th></tr>\n";
  410.     test.details += "<tr><td>AUTH_USER          </td><td>" + auth_user             + "</td></tr>\n";
  411.     test.details += "<tr><td>REMOTE_USER        </td><td>" + remote_user         + "</td></tr>\n";
  412.     test.details += "<tr><td>LOGON_USER         </td><td>" + logon_user             + "</td></tr>\n";
  413.     test.details += "<tr><td>HTTP_AUTHORIZATION </td><td>" + http_authorization     + "</td></tr>\n";
  414.     test.details += "</table>\n";
  415.  
  416.     switch( error ){
  417.         case 0:
  418.             test.Pass( "Access is anonymous, requiring no password security." );
  419.             break;
  420.         case 1:
  421.             test.Verify( "Password protection is set as basic authentication." );
  422.             break;
  423.         case 2:
  424.             test.Fail( "Access is password protected. The listed user is logged on. To use Dynamic Link this must be disabled. Use IP security with friends.asp instead." );
  425.             break;
  426.     }
  427.     return test;
  428. }
  429.  
  430.  
  431. function checkServerVariable()
  432. {
  433.     var test = new Test( "Check server variables" );
  434.  
  435.     test.description = "This test generates a table of server variables so that you can review and verify their status. ";
  436.     test.details  = "<table border=\"1\" cellpadding=\"4\">\n";
  437.     test.details += "<tr><th>Variable</th><th>Values</th></tr>\n";
  438.     test.details += writeServerVariables();
  439.     test.details += "</table>\n";
  440.  
  441.     test.Pass( "ASP server variables." );
  442.  
  443.     return test;
  444. }
  445.  
  446.  
  447. function checkServerConfigFiles()
  448. {
  449.     var test = new Test( "Check server config files" );
  450.  
  451.     test.description = "This test checks to see whether the ASP and XML files for Dynamic Link have been properly installed on the server. It also produces a directory tree list of all files in the config folder. ";
  452.     test.description += "The following files are required. ";
  453.  
  454.     var fso = Server.CreateObject( "Scripting.FileSystemObject" );
  455.     var configPath = fso.GetFolder( Server.MapPath( "." ) + "/../" );
  456.  
  457.     test.details = "Config Path = [" + configPath + "]<p>\n";
  458.  
  459.     var checkFiles = new Array(
  460.         "info/ado.info5.asp",
  461.         "info/mscommerce.info5.asp",
  462.         "info/parseasp.asp",
  463.         "info/ui5.asp", 
  464.         "info/ado.ui5.xml",
  465.         "info/mscommerce.ui5.xml",
  466.         "info/plugnpay.ui5.xml",
  467.         "info/vbscript.ui5.xml",
  468.         "include/ado.runtime5.asp",
  469.         "include/mscommerce.runtime5.asp",
  470.         "include/office.runtime5.asp",
  471.         "include/utils.runtime5.asp",
  472.         "include/friends.asp", 
  473.         "actions/ado.actions5.asp",
  474.         "actions/mscommerce.actions5.asp",
  475.         "actions/plugnpay.actions5.asp");
  476.  
  477.     var    error = 0;
  478.  
  479.     test.details += "<table border=\"1\" cellpadding=\"4\">\n";
  480.     test.details += "<tr><th>File</th><th>Exist</th></tr>\n";
  481.     for( var i = 0; i < checkFiles.length; i++ ){
  482.         var filePath = configPath + "/" + checkFiles[i];
  483.         test.details += "<tr><td>" + checkFiles[i] + "</td>";
  484.         if( fso.FileExists( filePath )){
  485.             test.details += "<td>Found</td></tr>\n";
  486.         }else{
  487.             test.details += "<td><b><font color=\"red\">Not Found</font></b></td></tr>\n";
  488.             error++;
  489.         }
  490.     }
  491.     test.details += "</table>\n";
  492.     test.details += "<p>Config files:<br>\n";
  493.     test.details += "<pre>\n";
  494.     test.details += directoryTree( fso.GetFolder( Server.MapPath( "." ) + "/../" ), 0 )
  495.     test.details += "</pre>\n";
  496.  
  497.     if( error == 0)    test.Pass( "All server configuration files are present." );
  498.     else            test.Fail( error + " file(s) are missing from your config folder." );
  499.     return test;
  500. }
  501.  
  502.  
  503. function checkServerConfigFilesReturnCode()
  504. {
  505.     var test = new Test( "Check config file's line endings" );
  506.  
  507.     test.description  = "This test checks whether the Dynamic Link text files have proper line endings. If you upload the config files or other ASP files from a Macintosh using binary upload, ";
  508.     test.description += "ASP may not work properly. You must upload ASP files as text. ";
  509.     test.description += "Also if the file's line ending is not set to Windows, ASP pages may not work. ";
  510.     test.description += "This is set in GoLive under Special>Web Database, Global tab, select Windows (CR/LF) from the popup menu. ";
  511.  
  512.     var fso = Server.CreateObject( "Scripting.FileSystemObject" );
  513.     var filePath = String( fso.GetFolder( Server.MapPath( "." ) + "/../" )) + "/include/friends.asp";
  514.     test.details = "Checking file = [" + filePath + "]<p>\n";
  515.     var    error = 0;
  516.  
  517.     if( fso.FileExists( filePath )){
  518.         var ts = fso.OpenTextFile( filePath, 1 ); // forReading
  519.         var    lineCounter = 0;
  520.         while( !ts.AtEndOfStream ){
  521.             var line = ts.ReadLine();
  522.             lineCounter++;
  523.         }
  524.         test.details += lineCounter + " line(s)<p>\n";
  525.         if( lineCounter == 0 )        test.Fail( "The file is empty." );
  526.         else if( lineCounter == 1 )    test.Fail( "The file has no line breaks. If the page was uploaded from a Mac, make sure it is uploaded as text." );
  527.         else                        test.Pass( "The file was uploaded correctly." );
  528.     }else{
  529.         test.details += "config/include/friends.asp was not found<br>\n";
  530.         test.Fail( "Server configuration files have not been uploaded properly." );
  531.         error++;
  532.     }
  533.     return test;
  534. }
  535.  
  536.  
  537. function checkServerConfigFriendsFile()
  538. {
  539.     var test = new Test( "Check config/include/friends.asp file" );
  540.  
  541.     test.description  = "This test checks the friends.asp file, which is used to provide IP based security. By default, access to the Dynamic Link files is only allowed to the local host. ";
  542.     test.description += "To allow access from machines you need must edit the config/include/friends.asp file to include the IP address of that machine. ";
  543.  
  544.     var fso = Server.CreateObject( "Scripting.FileSystemObject" );
  545.     var filePath = String( fso.GetFolder( Server.MapPath( "." ) + "/../" )) + "/include/friends.asp";
  546.  
  547.     test.details = "Checking file = [" + filePath + "]<p>\n";
  548.  
  549.     var    error = 0;
  550.     var    checker = 0;
  551.  
  552.     if( fso.FileExists( filePath )){
  553.         var ts = fso.OpenTextFile( filePath, 1 ); // forReading
  554.         test.details += "<table border=\"1\" cellpadding=\"4\"><tr><th>IP address</th><th>Mask</th><th>Note</th></tr>\n";
  555.         while( !ts.AtEndOfStream ){
  556.             var line = ts.ReadLine();
  557.             if(( line.length == 0 )||( line.charAt( 0 ) == ";" )||( line.charAt( 0 ) == "<" )){
  558.                 continue;
  559.             }
  560.             var splitline = line.split(/\s/);
  561.             var addr = splitline[0].split( "." );
  562.             var mask = ( splitline.length > 1 ) ? splitline[1].split( "." ) : new Array( 255, 255, 255, 255 );
  563.             test.details += "<tr><td>" + addr[0] + "." + addr[1] + "." + addr[2] + "." + addr[3] + "</td><td>" + mask[0] + "." + mask[1] + "." + mask[2] + "." + mask[3] + "</td><td>\n";
  564.  
  565.             if(( addr[0] == 127 )&&( addr[1] ==      0 )&&( addr[2] ==      0 )&&( addr[3] ==      1 )&&
  566.                ( mask[0] == 255 )&&( mask[1] == 255 )&&( mask[2] == 255 )&&( mask[3] == 255 )){
  567.                 test.details += "This is the default setting.\n";
  568.                 if( checker == 0 )    checker = 1;        // default setting
  569.             }else if(( addr[0] == 0 )&&( addr[1] == 0 )&&( addr[2] == 0 )&&( addr[3] == 0 )&&
  570.                      ( mask[0] == 0 )&&( mask[1] == 0 )&&( mask[2] == 0 )&&( mask[3] == 0 )){
  571.                 test.details += "This will disable all security.\n";
  572.                 checker = 2; // disable all security
  573.             }else if(( 255 < addr[0] )||( 255 < addr[1] )||( 255 < addr[2] )||( 255 < addr[3] )||
  574.                      ( 255 < mask[0] )||( 255 < mask[1] )||( 255 < mask[2] )||( 255 < mask[3] )||
  575.                      (     0 > addr[0] )||(    0 > addr[1] )||(   0 > addr[2] )||(      0 > addr[3] )||
  576.                      (     0 > mask[0] )||(    0 > mask[1] )||(   0 > mask[2] )||(      0 > mask[3] )){
  577.                 test.details += "This is an invalid setting. Each section of IP address and mask must be between 0 and 255.\n";
  578.                 checker = 4; // invalid setting
  579.             }else{
  580.                 test.details += "Other settings<br>\n";
  581.                 if( checker != 2 )    checker = 3;
  582.             }
  583.             test.details += "</td></tr>\n";
  584.         }
  585.         test.details += "</table>\n";
  586.         switch( checker ){
  587.             case 0:
  588.                 test.Fail( "The friends.asp file contains no IP addresses for access." );
  589.                 break;
  590.             case 1:
  591.                 test.Verify( "The friends.asp file is the same as default install. It will only allow access to the local host. " );
  592.                 break;
  593.             case 2:
  594.                 test.Verify( "The friends.asp file is set as \"disable all security\". " );
  595.                 break;
  596.             case 3:
  597.                 test.Pass( "Server configuration is done." );
  598.                 break;
  599.             default:
  600.                 test.Fail( "Server configuration files are not set properly." );
  601.                 break;
  602.         }
  603.     }else{
  604.         test.details += "config/include/friends.asp was not found<br>\n";
  605.         test.Fail( "Server configuration files were not uploaded properly." );
  606.         error++;
  607.     }
  608.     return test;
  609. }
  610.  
  611.  
  612. function checkServerConfigWritePrivilege()
  613. {
  614.     var test = new Test( "Check config/include folder write permission" );
  615.  
  616.     test.description  = "This test checks the write permission of config/include folder, which is used by GoLive's Preview function. ";
  617.     test.description += "To preview a dynamic page, GoLive uploads a temporary file to config/include folder so that the web server can process it. ";
  618.     test.description += "If the folder does not have write permission, the preview will not work. ";
  619.     test.description += "Note that you may want to disable write permission on your production servers. ";
  620.     test.description += "In that case, you will not be able to use the GoLive preview with the public server as your Config URL. ";
  621.     test.description += "Other features will not be effected. ";
  622.     test.description += "<p>If error 'ASP 0177 : 800a0046' is returned when previewing a page in GoLive, the folder does not have write permission set. ";
  623.  
  624.     var fso = Server.CreateObject( "Scripting.FileSystemObject" );
  625.     var filePath = fso.GetFileName( Server.MapPath( "." ) + "../include/writingtest.txt" );
  626.  
  627.     test.details = "Test file = [" + filePath + "]<p>\n";
  628.     var    error = 0;
  629.     var    checker = 0;
  630.  
  631.     if( fso.FileExists( filePath )){
  632.         error = -1;
  633.     }else{
  634.         if( !testWriteFileOnServer( fso, filePath )){
  635.             error++;
  636.             test.details += "<div class=\"failed\">File operation failed to create, write, close, or delete.</div>\n";
  637.         }
  638.     }
  639.     if( error == 0 )
  640.         test.Pass( "File writing test was successful." );
  641.     else if( error == -1 )
  642.         test.Fail( "The test filename already exists." );
  643.     else
  644.         test.Fail( "File writing test failed." );
  645.  
  646.     return test;
  647. }
  648.  
  649.  
  650. function checkParentPath()
  651. {
  652.     var test = new Test( "Check that \"..\" is allowed" );
  653.  
  654.     test.description  = "This test checks to make sure that Dynamic Link config files can access the \"..\" folder. ";
  655.     test.description += "If the parent folder is not accessible using \"..\" the config files will not work. ";
  656.  
  657.     if( testParentPath() ){
  658.         var fileSystem = Server.CreateObject( "Scripting.FileSystemObject" );
  659.         var current = fileSystem.GetFolder( Server.MapPath( "." ));
  660.         var parent    = fileSystem.GetFolder( Server.MapPath( "." ) + "/../" );
  661.  
  662.         test.details = "<table border=\"1\" cellpadding=\"4\">\n";
  663.         test.details += "<tr><th>Path</th><th>Value</th></tr>\n";
  664.         test.details += "<tr><td>Current path</td><td>" + current + "</td></tr>\n";
  665.         test.details += "<tr><td>Parent path </td><td>" + parent  + "</td></tr>\n";
  666.         test.details += "</table>\n";
  667.  
  668.         test.Pass( "Parent folder is accessible with \"..\"." );
  669.     }else{
  670.         test.Fail("Parent folder is not accessible with \"..\".");
  671.     }
  672.     return test;
  673. }
  674.  
  675.  
  676. function checkServerXMLFileFormat()
  677. {
  678.     var test = new Test("Check XML files");
  679.  
  680.     test.description  = "This test performs a basic syntax check on the XML files in config/info folder. ";
  681.     test.description += "It tests whether there are the same number of open and close tags to catch typing errors that may arise when these ";
  682.     test.description += "files are edited. The following is a list of the tags found in each file.";
  683.  
  684.     var fso = Server.CreateObject("Scripting.FileSystemObject");
  685.     var folder = fso.GetFolder(server.mapPath(".") + "/../info");
  686.     var    error = 0;
  687.  
  688.     var folderContents = new Enumerator(folder.files);
  689.  
  690.     test.details = "<table border=\"1\" cellpadding=\"4\">\n";
  691.     test.details += "<tr><th>XML File</th><th>Check</th></tr>\n";
  692.  
  693.     for( ; !folderContents.atEnd(); folderContents.moveNext() ){
  694.         var file = folderContents.item();
  695.         if( fso.GetExtensionName(file).toUpperCase() != "XML" ){
  696.             continue;
  697.         }
  698.         test.details += "<tr><td>" + file.name + "</td><td>\n";
  699.         var ForReading = 1;
  700.         var TristateTrue = -1; // Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
  701.         var fp = fso.OpenTextFile( file, ForReading, false, 0 );
  702.         var    lineCounter = 0;
  703.         var tags = new Array;
  704.         while( !fp.AtEndOfStream ){
  705.             var line = fp.ReadLine();
  706.             lineCounter++;
  707.             var tagName = "";
  708.             var insideTag = false;
  709.             for( var pointer = 0; pointer < line.length; pointer++ ){
  710.                 if( line.charAt( pointer ) == "<" ){
  711.                     if( insideTag ){
  712.                         test.details += "<span class=\"failed\">Line #" + lineCounter + ": Tag name [" + tagName +"] you cannot use "<" in XML tag.</span><br>\n";
  713.                         error++;
  714.                         break;
  715.                     }
  716.                     insideTag = true;
  717.                     continue;
  718.                 }
  719.                 if( line.charAt( pointer ) == ">" ){
  720.                     if( !insideTag ){
  721.                         test.details += "<span class=\"failed\">Line #" + lineCounter + ": Tag name [" + tagName +"] you cannot use ">" in XML tag.</span><br>\n";
  722.                         error++;
  723.                         break;
  724.                     }
  725.                     insideTag = false;
  726.                     var tagFound = false;
  727.                     var closeTag = false;
  728.                     if( tagName.charAt( 0 ) == "/" ){
  729.                         closeTag = true;
  730.                         tagName = tagName.substring( 1, tagName.length );
  731.                     }
  732.                     var arrayCount = 0;
  733.                     for( arrayCount = 0; arrayCount < tags.length; arrayCount++ ){
  734.                         if( tagName == tags[arrayCount].name ){
  735.                             tagFound = true;
  736.                             if( closeTag )    tags[arrayCount].close++;
  737.                             else            tags[arrayCount].open++;
  738.                             break;
  739.                         }
  740.                     }
  741.                     if( !tagFound ){
  742.                         tags[arrayCount] = new Object;
  743.                         tags[arrayCount].name = tagName;
  744.                         tags[arrayCount].open = 0;
  745.                         tags[arrayCount].close = 0;
  746.                         if( closeTag )    tags[arrayCount].close++;
  747.                         else            tags[arrayCount].open++;
  748.                     }
  749.                     tagName = "";
  750.                     continue;
  751.                 }
  752.                 if( insideTag )
  753.                     tagName += line.charAt( pointer );
  754.             }
  755.             if( insideTag ){
  756.                 test.details += "<span class=\"failed\">Line #" + lineCounter + ": Tag name [" + tagName +"] is not closed.</span><br>\n";
  757.                 error++;
  758.                 break;
  759.             }
  760.         }
  761.         test.details += "<table border=\"1\" cellpadding=\"4\"><tr><th>Tag name</th><th>Open</th><th>Close</th><th>Check</th></tr>\n";
  762.         for( var i = 0; i < tags.length; i++ ){
  763. //            test.details += "tag name=[" + tags[i].name + "]: open " + tags[i].open + " / close " + tags[i].close + "<br>\n";
  764.             test.details += "<tr><td>" + tags[i].name + "</td><td>" + tags[i].open + "</td><td>" + tags[i].close + "</td><td>";
  765.             if( tags[i].open != tags[i].close ){
  766.                 test.details += "<span class=\"failed\">NG:Not matched</span>";
  767.                 error++;
  768.             }else{
  769.                 test.details += "<span class=\"passed\">OK</span>";
  770.             }
  771.             test.details += "</td></tr>\n";
  772.         }
  773.         test.details += "</table>\n";
  774.         test.details += "</td></tr>\n";
  775.     }
  776.     test.details += "</table>\n";
  777.  
  778.     if( error == 0 )    test.Pass( "All XML files format seems to be fine." );
  779.     else                test.Fail( "One or more XML file(s) have problem(s)." );
  780.  
  781.     return test;
  782. }
  783.  
  784.  
  785. function checkServerDefaultDatabaseFiles()
  786. {
  787.     var test = new Test("Check default installed database files");
  788.  
  789.     test.description  = "This test checks the status of the three sample database files (Adobe.mdb, LooseScrews.mdb & Magazine.mdb) that are installed in config/database folder by default. ";
  790.     test.description += "These Microsoft Access (*.mdb) files should be read/write. ";
  791.     test.description += "If they are read-only, any update or other database modification action will fail. ";
  792.     test.description += "Note: You do not need to keep these database files on your server when you have installed your own database files, however they are required for the sample demo files to work. ";
  793.  
  794.     var fso = Server.CreateObject("Scripting.FileSystemObject");
  795.     var configPath = fso.GetFolder(Server.MapPath(".") + "/../");
  796.     
  797.     test.details = "Config Path = [" + configPath + "]<p>\n";
  798.  
  799.     var checkFiles = new Array("databases/Adobe.mdb", "databases/LooseScrews.mdb", "databases/Magazine.mdb");
  800.     var    error = 0;
  801.     var    errorReadOnly = 0;
  802.  
  803.     test.details += "<table border=\"1\" cellpadding=\"4\">\n";
  804.     test.details += "<tr><th>File</th><th>Exist</th><th>Attributes</th></tr>\n";
  805.     for( var i = 0; i < checkFiles.length; i++ ){
  806.         var filePath = configPath + "/" + checkFiles[i];
  807.         test.details += "<tr><td>" + checkFiles[i] + "</td>";
  808.         if( fso.FileExists( filePath )){
  809.             var file = fso.GetFile( filePath );
  810.             test.details += "<td>Found</td><td>\n";
  811.             if( file.attributes & FileAttrReadOnly ){
  812.                 test.details += "<font color=\"red\"><b>Read-Only</b></font><br>\n";
  813.                 errorReadOnly++;
  814.                 error++;
  815.             }
  816.             if(file.attributes & FileAttrDirectory    )    test.details += "Directory<br>\n";
  817.             if(file.attributes & FileAttrHidden        )    test.details += "Hidden<br>\n";
  818.             if(file.attributes & FileAttrSystem        )    test.details += "System<br>\n";
  819.             if(file.attributes & FileAttrVolume        )    test.details += "Volume<br>\n";
  820.             if(file.attributes & FileAttrArchive    )    test.details += "Archive<br>\n";
  821.             if(file.attributes & FileAttrAlias        )    test.details += "Alias<br>\n";
  822.             if(file.attributes & FileAttrCompressed )    test.details += "Compressed<br>\n";
  823.             test.details += "</td></tr>\n";
  824.         }else{
  825.             test.details += "<td><b><font color=\"green\">Not Found</font></b></td><td></td></tr>\n";
  826.             error++;
  827.         }
  828.     }
  829.     test.details += "</table>\n";
  830.     
  831.     if( error == 0 ){
  832.         test.Pass( "All default database files were found." );
  833.     }else{
  834.         if ( errorReadOnly == 0)    test.Verify( "No databases were found.  Check the config/database folder." );
  835.         else                        test.Fail( "Database(s) are set as read-only. The MDB files must to be writable to update records.  Check the config/database folder." );
  836.     }
  837.     return test;
  838. }
  839.  
  840.  
  841. function checkServerDatabaseFiles()
  842. {
  843.     var test = new Test( "Check database files" );
  844.  
  845.     test.description  = "This test examines all the database files found in the config/databases folder and produces detailed information about each one. ";
  846.     test.description += "MS-Access (*.mdb) files should not be read-only. ";
  847.     test.description += "If they are read-only any update or other database modification action will fail. ";
  848.     test.description += "If MDB files failed to open a connection, the server may have old MDAC version. ";
  849.     test.description += "MDAC 1.5 is installed by default with IIS 4.0, but Dynamic Link requires MDAC 2.1 or later. ";
  850.     test.description += "You can get updater from Microsoft website (http://www.microsoft.com/data/). ";
  851.     test.description += "If UDL, DSN or XDB files failed to open a connection, these files have incorrect settings or the database is unavailable. ";
  852.     test.description += "If OpenSchema fails and the other tests are OK, the local server's ASP engine may not support the OpenSchema() call. ";
  853.     test.description += "In this case, the server will not work as a development server with Dynamic Link. ";
  854.  
  855.     var fso = Server.CreateObject( "Scripting.FileSystemObject" );
  856.     var folder = fso.GetFolder( server.mapPath( "." ) + "/../databases" );
  857.     var    error = 0;
  858.  
  859.     var folderContents = new Enumerator( folder.files );
  860.  
  861.     test.details  = "<table border=\"1\" cellpadding=\"4\">\n";
  862.     test.details += "<tr><th>File</th><th>Attributes</th><th>Connection</th><th>OpenSchema</th><th>Tables/Fields</th></tr>\n";
  863.  
  864.     for( ; !folderContents.atEnd(); folderContents.moveNext() ){
  865.         var file = folderContents.item();
  866.         test.details += "<tr><td>" + file.name + "</td>";
  867.         test.details += "<td>\n";
  868.         if( file.attributes & FileAttrReadOnly ){
  869.             if( fso.GetExtensionName( file ).toUpperCase() == "MDB" ){
  870.                 test.details += "<font color=\"red\"><b>Read-Only</b></font><br>\n";
  871.                 error++;
  872.             }else{
  873.                 test.details += "Read-Only<br>\n";
  874.             }
  875.         }
  876.         if( file.attributes & FileAttrDirectory     )    test.details += "Directory<br>\n";
  877.         if( file.attributes & FileAttrHidden     )    test.details += "Hidden<br>\n";
  878.         if( file.attributes & FileAttrSystem     )    test.details += "System<br>\n";
  879.         if( file.attributes & FileAttrVolume     )    test.details += "Volume<br>\n";
  880.         if( file.attributes & FileAttrArchive     )    test.details += "Archive<br>\n";
  881.         if( file.attributes & FileAttrAlias         )    test.details += "Alias<br>\n";
  882.         if( file.attributes & FileAttrCompressed )    test.details += "Compressed<br>\n";
  883.         test.details += "</td><td>\n";
  884.         var    connectString = "";
  885.  
  886.         switch( fso.GetExtensionName( file ).toUpperCase() ){
  887.             case "MDB":    
  888.                 test.details += "MDB<br>\n";
  889. //                connectString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + fso.GetAbsolutePathName( file );    //    ODBC driver
  890.                 connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fso.GetAbsolutePathName( file );//    OLE DB driver
  891.                 break;
  892.             case "DSN":    
  893.                 test.details += "DSN<br>\n";
  894.                 connectString = "FILEDSN=" + fso.GetAbsolutePathName( file );
  895.                 break;
  896.             case "UDL":    
  897.                 test.details += "UDL<br>\n";
  898.                 connectString = "File Name=" + fso.GetAbsolutePathName( file );
  899.                 break;
  900.             case "XDB":    
  901.                 test.details += "XDB<br>\n";
  902.                 connectString = "DSN=" + fso.GetBaseName( file );
  903.                 break;
  904.             default:    
  905.                 test.details += "unsupported\n";
  906.                 break;
  907.         }
  908.         if( "" == connectString )    continue;
  909.         var connection = new ActiveXObject( "ADODB.Connection" );
  910.  
  911.         if( !testConnectionOpen( connection, connectString )){
  912.             test.details += "<span class=\"failed\">Failed</span>\n";
  913.             test.details += "</td><td></td><td></td></tr>\n";
  914.             error++;
  915.             continue;
  916.         }
  917.         test.details += "Success";
  918.         test.details += "</td><td>\n";
  919.  
  920.         var result = testOpenSchema(connection);
  921.         if( result == "" ){
  922.             test.details += "<span class=\"failed\">Failed</span></td><td>";
  923.             error++;
  924.         }else{
  925.             test.details += result;
  926.         }
  927.         connection.Close();
  928.         test.details += "</td></tr>\n";
  929.     }
  930.     test.details += "</table>\n";
  931.  
  932.     if( error == 0 ){
  933.         if( noPrimaryKey == 0 )    test.Pass("All database files were found and examined.");
  934.         else                    test.Verify("Some tables do not have primary key field.");
  935.     }else    test.Fail("Problem(s) were found with one or more database file(s), or OpenSchema() is not supported.");
  936.  
  937.     return test;
  938. }
  939.  
  940.  
  941. function checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  942. {
  943.     test.details += "<div class=\"manual\">\n";
  944.     test.details += "<span class=\"manualTitle\">" + title + "</span><p>\n";
  945.     test.details += "<span class=\"manualSymptom\"> <b>Symptom: </b>" + symptom + "</span><p>\n";
  946.     test.details += "<span class=\"manualPrescription\"> <b>Prescription: </b>" + prescription + "</span>\n";
  947.     test.details += "</div>\n";
  948. }
  949.  
  950.  
  951. function checkOther()
  952. {
  953.     var test = new Test( "Check other issues" );
  954.  
  955.     test.description  = "If you are still having problems, here's a listing of known issues you can check manually. ";
  956.     test.description += "Some problems may be dependent on web server versions, database server, database driver. ";
  957.  
  958.     var title = "";
  959.     var symptom = "";
  960.     var prescription = "";
  961.     test.details = "";
  962.  
  963.     title = "MDAC (Microsoft Data Access) version";
  964.     symptom = "MDAC version 1.5 will fail to connect with Access 2000 databases. (MDAC 1.5 is part of the Option Pack for IIS, and is not updated by Windows NT service packs.)";
  965.     prescription = "MDAC 2.1 or later is required for Dynamic Link.  MDAC is installed in [system drive]:\\Program Files\\Common Files\\System\\ado\\ folder. ";
  966.     prescription += "If you have the file ADO210.CHM, the server has MDAC 2.1 installed.";
  967.     prescription += "<p>Windows 2000 installs MDAC version 2.5, which is compatible with Dynamic Link.</p>";
  968.     prescription += "<p>To update MDAC, go to Microsoft web site http://www.microsoft.com/data/ or do a search for \"MDAC\". ";
  969.     prescription += "Microsoft also offers an MDAC version checker, called \"Component Checker\".</p>";
  970.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  971.  
  972.     title = "IIS \"Enable Parent Paths\" setting";
  973.     symptom = "If \"Enable Parent Paths\" is checked OFF, it may cause ASP 0131 (0x80004005) error.";
  974.     prescription = "\"Enable Parent Paths\" should be checked ON as default. You can find the setting at following location.<br>"
  975.     prescription += "Virtual Root Properties<br>";
  976.     prescription += "- Virtual Directory<br>";
  977.     prescription += "-- Configuration<br>";
  978.     prescription += "--- App Options<br>";
  979.     prescription += "---- Enable Parent Paths";
  980.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  981.  
  982.     title = "Primary Key Field";
  983.     symptom = "When the runtime debug switch is on (you can set the RuntimeDebug flag in config/inlude/utils.runtime5.asp), ";
  984.     symptom += "you may receive an error message \"Runtime Error: No primary key is specified\" when you preview an ASP document.";
  985.     symptom += "You may also experience significant performance degradation without a primary key.";
  986.     prescription = "This may be caused by using an ODBC driver, which does not support automatic detection of primary keys. "
  987.     prescription += "This may cause incorrect results or behavior when displaying multiple records in a table, or when updating or ";
  988.     prescription += "deleting records using a form.";
  989.     prescription += "<p>You can manually specify the primary key field by editing the WrapRecordSet() function call in the ";
  990.     prescription += "document's <head> section. For example, change:";
  991.     prescription += "<dl><dd>set Article = WrapRecordSet(ArticleRecordSet)</dl> to:";
  992.     prescription += "<dl><dd>set Article = WrapRecordSet(ArticleRecordSet, \"ID\")</dl>";
  993.     prescription += "or, if more than one field comprises the primary key, enter each separated by commas:";
  994.     prescription += "<dl><dd>set Product = WrapRecordSet(ProductRecordSet, \"ID,SKU\")</dl>";
  995.     prescription += "If you are using the OLE DB driver for your database (which is recommended), you do not have to edit ";
  996.     prescription += "this function call, the Dynamic Link module will automatically add the correct primary key field(s).";
  997.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  998.  
  999.     title = "Text Input and Menu Fields";
  1000.     symptom = "<br>* Strings in text fields, radio buttons, or menus are truncated.";
  1001.     symptom += "<br>* Runtime errors occur when you update a record.";
  1002.     prescription = "If you create a text input field and link it to a database field using Dynamic Link, records that "
  1003.     prescription += "contain single quotation marks may result in the web server generating erroneous HTML code from ";
  1004.     prescription += "your ASP document. If your data contains single quotes (such as a last name field with a record for a ";
  1005.     prescription += "person named \"O'Grady\") you should manually add a call to fixHTMLquotes to your ASP document, ";
  1006.     prescription += "for example, change:";
  1007.     prescription += "<dl><dd><input name=\"abc\" value='<%=foo.Value(\"LastName\")%>'></dl> to:";
  1008.     prescription += "<dl><dd><input name=\"abc\" value='<%=fixHTMLquotes(foo.Value(\"LastName\"))%>'></dl>";
  1009.     prescription += "Similarly, if you have radio buttons (INPUT tag) or menu items (OPTION tag) that might receive database ";
  1010.     prescription += "contents with single quote marks, you should use the fixHTMLquotes() function to avoid runtime errors.";
  1011.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1012.  
  1013.     title = "POST versus GET";
  1014.     symptom = "You get unexpected results or errors when you update records or link to detail pages.";
  1015.     prescription = "If you have a form in an ASP document, you should use POST rather than GET to avoid problems "
  1016.     prescription += "with the limits inherent with the GET method.";
  1017.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1018.  
  1019.     title = "HTML Tags in Database Records";
  1020.     symptom = "<TEXTAREA> tag breaks layout";
  1021.     prescription = "If records in your database include strings that might be interpreted as HTML tags (for example, "
  1022.     prescription += "\"</textarea>\") HTML rendering may fail.  To avoid this problem, set the field's filter ";
  1023.     prescription += "to \"Encode String as HTML\" in the Binding Details section of the Dynamic Link palette.";
  1024.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1025.  
  1026.     title = "ODBC driver from Oracle or Microsoft";
  1027.     symptom = "Dynamic Link page with Oracle database shows unexpected data.";
  1028.     prescription = "If you need to use an ODBC driver with Oracle (OLE DB is preferred, for reasons described earlier), "
  1029.     prescription += "you should use the Microsoft ODBC driver (named \"Microsoft ODBC for Oracle\") rather than the Oracle ";
  1030.     prescription += "ODBC driver (\"Oracle ODBC Driver\").";
  1031.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1032.  
  1033.     title = "FileMaker Pro 5 for ODBC";
  1034.     symptom = "<br>* Table and field names do not appear in the Dynamic Link palette.";
  1035.     symptom += "<br>* Previewing or running ASP pages results in runtime errors.";
  1036.     prescription = "To configure FileMaker Pro 5 for use with Dynamic Link, make sure that:"
  1037.     prescription += "<br>* FileMaker Pro 5 is running with your database open,";
  1038.     prescription += "<br>* the database is set as shared,";
  1039.     prescription += "<br>* the \"Remote Data Access Companion\" option (File > Sharing > Remote Data Access Companion) is enabled,";
  1040.     prescription += "<br>* the \"Use Remote Connection\" option in the ODBC data source control panel is enabled,";
  1041.     prescription += "<br>* the \"Server Address\" field of the ODBC control panel contains the IP address of the machine running FileMaker Pro.";
  1042.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1043.  
  1044.     title = "global.asa file";
  1045.     symptom = "Shopping cart's total price is wrong.";
  1046.     prescription = "global.asa file needs to be at root of virtual root setting."
  1047.     prescription += "Please check with above \"Check virtual path setting\".";
  1048.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1049.  
  1050.     title = "Virtual root setting.";
  1051.     symptom = "<br>* Browser shows 404 error.";
  1052.     symptom += "<br>* Updating record goes to the wrong URL.";
  1053.     prescription = "You should use the same path name on both your staging server and production server.  "
  1054.     prescription += "For example, if you develop ASP pages on your computer using a content source of ";
  1055.     prescription += "http://localhost/golive/, your production server virtual root path should be /golive/ also.";
  1056.     prescription += "The host name may be (and generally, will be) different; this will not affect your ASP documents.";
  1057.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1058.  
  1059.     title = "config/info folder";
  1060.     symptom = "Potential security hole";
  1061.     prescription = "The files in the \"info\" folder (config/info/*.*) are used by the Dynamic Link module to create "
  1062.     prescription += "ASP documents, but are not needed when you deploy your finished pages.  You should not install ";
  1063.     prescription += "the config/info files on your production server because of the potential for security problems.<p>";
  1064.     prescription += "You may wish to install these files temporarily to verify your production server's environment ";
  1065.     prescription += "using this troubleshooting.asp document, but should remove them after completing the tests.";
  1066.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1067.  
  1068.     title = "config/databases folder";
  1069.     symptom = "Potential security hole";
  1070.     prescription = "The config/databases folder contains database files, or UDL files "
  1071.     prescription += "contains database information, possibly including ID/password information.<p>";
  1072.     prescription += "To prevent unauthorized access to your database files, you should disallow \"Read\", \"Write\" ";
  1073.     prescription += "and \"Directory browsing\" permissions under IIS to the config/databases folder.<p>";
  1074.     prescription += "For increased security, you can move the config/database folder out of the virtual root.  ";
  1075.     prescription += "In this case, you will need to edit GetDatabasePath() function in config/include/utils.runtime5.asp file.";
  1076.     checkOtherSubAddToTestDetails( test, title, symptom, prescription )
  1077.  
  1078.     test.Verify("Check these issues manually.");
  1079.  
  1080.     return test;
  1081. }
  1082.  
  1083.  
  1084. //--- Utility Functions -------------------------------------------------------
  1085. // These are used by the test functions.
  1086. // ----------------------------------------------------------------------------
  1087.  
  1088. // file attribute bit fields
  1089. var FileAttrNormal        = 0;
  1090. var FileAttrReadOnly    = 1;
  1091. var FileAttrHidden        = 2;
  1092. var FileAttrSystem        = 4;
  1093. var FileAttrVolume        = 8;
  1094. var FileAttrDirectory    = 16;
  1095. var FileAttrArchive        = 32;
  1096. var FileAttrAlias        = 64;
  1097. var FileAttrCompressed    = 128;
  1098.  
  1099.  
  1100.  
  1101. // Recursively build an ASCII representation of a directory tree
  1102.  
  1103. function directoryTree( folder, level )
  1104. {
  1105.     var msg = "";
  1106.     var files = new Enumerator( folder.files );
  1107.     for( ; !files.atEnd(); files.moveNext() ){
  1108.         for (var i = 0; i < level; i++)
  1109.             msg += "|   ";
  1110.         msg += "    "
  1111.         msg += files.item().Name + "<br>";
  1112.     }
  1113.     var subfolders = new Enumerator( folder.SubFolders );
  1114.     for( ; !subfolders.atEnd(); subfolders.moveNext() ){
  1115.         for( var i = 0; i < level; i++ )    msg += "+---";
  1116.         msg += "+---"
  1117.         msg += subfolders.item().Name + "<br>";
  1118.         msg += directoryTree(subfolders.item(), level+1);
  1119.     }
  1120.     return msg;
  1121. }
  1122.  
  1123.  
  1124. function listDatabaseField( connection, tableName )
  1125. {
  1126.     var msg = "";
  1127.     var catalog = new ActiveXObject( "ADOX.Catalog" );
  1128.     var index    = new ActiveXObject( "ADOX.Index" );
  1129.     var table    = new ActiveXObject( "ADOX.Table" );
  1130.     var column    = new ActiveXObject( "ADOX.Column" );
  1131.     var column2 = new ActiveXObject( "ADOX.Column" );
  1132.     var    primaryKeyCounter = 0;
  1133.     var    indexColumnsSupport = true;
  1134.     
  1135.     catalog.ActiveConnection = connection;
  1136.  
  1137.     table = catalog.Tables.Item( String( tableName ));
  1138.     if( table.Type == "TABLE" ){    // only usr table, skip system table
  1139.         for( var j = 0; j < table.Columns.Count; j++ ){
  1140.             column = table.Columns.Item( j );
  1141.             msg += "<dd>" + column.Name + "\n";
  1142.             for( var k = 0; k < table.Indexes.Count; k++ ){
  1143.                 index = table.Indexes.Item( k );
  1144.                 if( !index.PrimaryKey )    continue;    //    skip non-primary key
  1145.                 if( testIndexColumns( index )){    // supported
  1146.                     for( var m = 0; m < index.Columns.Count; m++ ){
  1147.                         column2 = index.Columns.Item( m );
  1148.                         if( column2.Name == column.Name ){
  1149.                             msg += "<b>(primary key)</b>\n";
  1150.                             primaryKeyCounter++;
  1151.                             break;    // to avoid duplicated
  1152.                         }
  1153.                     }
  1154.                 }else{    //    not supported
  1155.                     indexColumnsSupport = false;
  1156.                 }
  1157.             }
  1158.         }
  1159.     }
  1160.     if( indexColumnsSupport ){
  1161.         if( primaryKeyCounter == 0 ){
  1162.             msg += "<br><span class=\"verify\">This table does not have a primary key field.</span>\n";
  1163.             noPrimaryKey++;
  1164.         }
  1165.     }else{
  1166.         msg += "<br><span class=\"verify\">Unable to discover primary key field automatically, because ODBC drivers do not support this feature.</span>\n";
  1167.         noPrimaryKey++;
  1168.     }
  1169.     return msg;
  1170. }
  1171.  
  1172. </script>
  1173.